<?php
/**
 * Created by PhpStorm.
 * User: jswei
 * Date: 2018/4/24
 * Time: 8:54
 */

namespace app\admin\model;

use think\Model;

class Orderlist extends Model{
    protected $pk = 'id';
    protected $table = 'think_orderlist';
    protected $autoWriteTimestamp = true;

    /**
     * @param array $where
     * @param int $pageSize
     * @param string $field
     * @return \think\Paginator
     * @throws \think\exception\DbException
     */
    public function getList($where= [], $pageSize=10,$field=''){
        $list = $this
            ->withJoin('Member')
            ->where($where)
            ->paginate($pageSize);
        return $list;
    }

    public function member(){
        return $this->hasOne('Member','id','uid');
    }

    public function getFinishTimeAttr($value){
        return $value?date('Y-m-d H:i:s',$value):'--';
    }
}